-
Notifications
You must be signed in to change notification settings - Fork 260
Add command to generate Fig spec for VS Code terminal IntelliSense #5955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
wbreza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!
weikanglim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good! As a VSCode user myself, I am excited and happy with these changes.
Two categories of questions came into my mind as I reviewed this:
- I had some workflow questions in the doc around how we should handle alpha features and extension-related commands.
- I had some overall thoughts around the additional completion metadata we're adding to the new figspec package. I could see us creating separate issues to clean up the custom stuff we're doing in figspec over time.
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Resolves #5656
Related: microsoft/vscode#272348
This PR adds a new command
azd completion figto automatically generate a Fig autocomplete spec for integration with VS Code's terminal IntelliSense. The Fig spec for azd used by VS Code IntelliSense lives in the vscode repo atextensions/terminal-suggest/src/completions/azd.ts.The command works by traversing the Cobra command tree to extract all commands, flags, and arguments and converts this information to TypeScript, following the spec format. Hidden commands and flags are omitted from the spec, but there is a
--include-hiddenflag (also hidden) that can be passed.Dynamic suggestions
The azd spec leverages Fig generators to dynamically provide context-aware suggestions for certain commands.
For example, when the user types
azd init -t, VS Code in the background executes and parsesazd template list --output jsonto provide dynamic suggestions:Other commands with dynamic suggestions include:
azd env selectazd env get-valueazd extension installOpen to thoughts but I think this is a sufficient enough initial spec - there's plenty of opportunity to extend the spec further and we can track them as separate issues.
Implementation/architecture
See documentation in
cli/azd/docs/fig-spec.mdTesting
This PR adds a new
figspec_test.gosnapshot test. The test creates a snapshot of the Fig spec atcli/azd/cmd/testdata/TestFigSpec.ts. Similar to theTestUsagesnapshot tests, whenever the command structure changes (such as when adding a new command or flag), the Fig spec snapshot needs to be updated as well or the test would fail: